/**
 * @description: 媒体类型
 * @param: 字符串 mediaType 媒体值
 */
export function mediaTypeFilter(mediaType: number): string {
    switch (+mediaType) {
        case 1:
            return '梯内屏';
        case 2:
            return '梯外屏';
        case 3:
            return '梯内框';
        case 4:
            return '梯外框';
        case 5:
            return '门禁';
        case 6:
            return '道闸';
        default:
            return '-';
    }
}

export function handlePremisesTypeFilter(type: string): string {
    switch (type) {
        case 'ADD':
            return '新建楼盘';
        case 'EDIT':
            return '编辑楼盘';
        case 'CREAT':
            return '创建楼盘';
        case 'VIEW':
            return '查看楼盘';
        default:
            return '-';
    }
}
export function handleImportTypeFilter(type: string): string {
    switch (type) {
        case 'SING':
            return '批量导入合同信息';
        case 'PREMISES':
            return '批量导入楼盘';
        default:
            return '-';
    }
}

export function numberToCurrencyNo(value: number): string {
    if (!value) {
        return '';
    }
    const intPart = Math.trunc(value);
    const intPartFormat = intPart.toString().replace(/(\d)(?=(?:\d{3})+$)/g, '$1,');
    let floatPart = '';
    const valueArray = value.toString().split('.');
    if (valueArray.length === 2) {
        floatPart = valueArray[1].toString();
        return intPartFormat + '.' + floatPart;
    }
    return intPartFormat + floatPart;
}
